
<form action="{:url('configEdit')}" method="post" class="form_single layui-form">






        <div class="box-body layui-tab layui-tab-card">
            <ul class="layui-tab-title">
            {volist name='data' id= "v" key='k'}

                {if condition="$k eq 1"}
                    <li class="layui-this">{$v.title}</li>

                {else/}
                    <li>{$v.title}</li>
                {/if}
            {/volist}
            </ul>
            <div class="layui-tab-content">
                {volist name='data' id= "v" key='k'}
                <div class="layui-tab-item {if condition='$k eq 1'} layui-show {/if}">
                    <div class="row">

                        {volist name="v.children" id= "vo"}
                        {switch name="vo.type" }
                        {case value="text" }

                        <div class="layui-form-item">
                            <label for="{$vo.code}" class="layui-form-label">
                                <span class="x-red">*</span>{$vo.title}
                            </label>
                            <div class="layui-input-block">
                                <input type="text" id="{$vo.code}" name="{$vo.code}" required="" lay-verify="required"
                                       autocomplete="off"  value="{$vo['value']|default=''}" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">
                                ({$vo.title})
                            </div>
                        </div>
                        {/case}
                        {case value="switch"}

                        <div class="layui-form-item col-md-12">
                            <label class="layui-form-label">{$vo.title}</label>
                            <div class="layui-input-block">
                                {if condition="$vo['value'] eq 1"}
                                <div class="layui-unselect layui-form-switch layui-form-onswitch onkey" data-code="{$vo.code}"  ><em>ON</em><i></i></div>
                                <div class="layui-unselect layui-form-switch offkey" style="display: none" data-code="{$vo.code}" ><em>OFF</em><i></i></div>
                                {else/}
                                <div class="layui-unselect layui-form-switch layui-form-onswitch onkey" data-code="{$vo.code}" style="display: none" ><em>ON</em><i></i></div>
                                <div class="layui-unselect layui-form-switch offkey" data-code="{$vo.code}"  ><em>OFF</em><i></i></div>
                                {/if}
                            </div>
                            <input type="hidden" name="{$vo.code}"  value="{$vo['value']}"/>
                        </div>

                        {/case}
                        {case value="radio"}
                        {switch name="vo.code" }
                            {case value="otc_remard_pattern"}
                                <div class="layui-form-item col-md-12">
                                    <label class="layui-form-label">{$vo.title}</label>
                                    <div class="layui-input-block">
                                        <input type="radio" name="{$vo.code}" value="1" title="模式一"    {if condition="$vo['value'] eq 1"}checked{/if} >
                                        <input type="radio" name="{$vo.code}" value="2" title="模式二"   {if condition="$vo['value'] eq 2"}checked{/if} >
                                    </div>
                                </div>
                            {/case}
                            {case value="app_balance_transfer_pattern"}
                            <div class="layui-form-item col-md-12">
                                <label class="layui-form-label">{$vo.title}</label>
                                <div class="layui-input-block">
                                    <input type="radio" name="{$vo.code}" value="1" title="不需要后台审核"    {if condition="$vo['value'] eq 1"}checked{/if} >
                                    <input type="radio" name="{$vo.code}" value="2" title="需要后台审核"   {if condition="$vo['value'] eq 2"}checked{/if} >
                                </div>
                            </div>
                            {/case}
                        {/switch}

                        {/case}

                        {default /}

                        <div class="layui-form-item">
                            <label for="{$vo.code}" class="layui-form-label">
                                <span class="x-red">*</span>{$vo.title}
                            </label>
                            <div class="layui-input-block">

                                {assign name="cover_id" value="$vo['value']|default='0'" /}
                                {:widget('file/index', ['name' => $vo.code, 'value' => $cover_id, 'type' => 'img'])}
                            </div>

                        </div>


                        {/switch}

                        {/volist}





                    </div>
                </div>
                {/volist}

            </div>



            <div class="box-footer">



                {include file="layout/edit_btn_group"/}

            </div>

        </div>

</form>


<script>


    $('.onkey').click(function () {
        $(this).hide();
        $(this).next().show();
        $("input[name='"+$(this).attr('data-code')+"']").val(0);
    })
    $('.offkey').click(function () {
        $(this).hide();
        $(this).prev().show();
        $("input[name='"+$(this).attr('data-code')+"']").val(1);

    })

    //Demo
    layui.use('form', function() {
        var form = layui.form;
    })

</script>